package com.ht.interfaces.request.mq;

import com.ht.api.db.DbList;
import com.ht.api.db.Entity;
import com.ht.api.db.annotate.FuncCall;
import com.ht.api.db.annotate.FuncGroup;
import com.ht.api.db.annotate.FuncId;
import com.ht.api.db.annotate.FuncName;
import com.ht.api.db.bean.DataResult;
import com.ht.api.db.bean.SessionBean;
import com.ht.api.db.request.IHandleRequest;
import com.ht.api.db.util.HtUtil;
import com.ht.api.db.util.MqUtil;

import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@FuncId("1914506624081465344")
@FuncGroup("测试相关")

@FuncCall
@FuncName("测试mq")
public class TestMqCall implements IHandleRequest {

	@Override
	public void execute(SessionBean me, JSONObject param, DataResult result) {
		DbList list = DbList.create();
		String now = DateUtil.now();
		for (int i = 0; i < 10; i++) {
			Entity entity = Entity.create("source_data_test");
			entity.set("source_code", "测试source_code");
			entity.set("table_code", "测试table_code");
			entity.set("data", i + "_" + now);
			list.add(entity);
		}
		MqUtil.send(1876286380045373440L, list);
	}

	public static void main(String[] args) {
		System.err.println("@FuncId>>" + HtUtil.getId());
		
//		JSONObject result = CallTestUtil.autoTest(new Object(){}.getClass().getEnclosingClass().getSimpleName());
//		System.err.println(result.toStringPretty());
	}
}
